package com.example.paopao.consumer.account.controller;

import com.example.paopao.common.web.JsonResult;
import com.example.paopao.consumer.account.pojo.dto.UserRegDTO;
import com.example.paopao.consumer.account.service.IUserService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@Validated
@RestController
@Api(tags = "01. 注册模块")
@RequestMapping("/v1/users/")
public class UserController {
    @Autowired
    private IUserService service;
    @ApiOperation("用户注册")
    @ApiOperationSupport(order = 100)
    @PostMapping("reg")
    public JsonResult reg( @Valid @RequestBody  UserRegDTO userRegDTO){
        System.out.println("userRegDTO ="+userRegDTO);
        service.reg(userRegDTO);
        return JsonResult.ok();
    }

}
